<template>
    <div>
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <!-- <el-breadcrumb-item :to="{path:'/'}">首页</el-breadcrumb-item>
            <el-breadcrumb-item>活动管理</el-breadcrumb-item>
            <el-breadcrumb-item>活动列表</el-breadcrumb-item>
            <el-breadcrumb-item>活动详情</el-breadcrumb-item> -->
            <el-breadcrumb-item v-for="v in lists" :key="v.path">
              <router-link :to="v.path">  
                {{ v.meta.title }}
            </router-link>
            </el-breadcrumb-item>
          </el-breadcrumb>
    </div>
</template>

<script>
  export default {
    data(){
        return {
           lists:[]
        }
    },
    watch:{
        //大小写，单复数，时态 花时间的
      $route(to,from){
        
       // this.lists = to.matched;
       this.getBreadcrumb(to.matched)
      }
        
    },
    
    methods:{
      getBreadcrumb(matched){
         if(matched.length && matched[1].name=='index'){
           matched = [{path:'/home',name:'home',meta:{title:'首页'}}];
         }
         this.lists = matched;
           
        } 
    },
   
    mounted(){
       //  this.lists = this.$route.matched;
      this.getBreadcrumb(this.$route.matched)
    },
    components:{

    }
  }
</script>